Question: Let $f(x, y) = y^2\sin(x)$. What is the Hessian of $f$ ? Choose 1 answer: Choose 1 answer: (Choice A) A $\begin{bmatrix} 2y\cos(x) & -y^2\sin(x) \\ \\ 2\sin(x) & 2y\cos(x) \end{bmatrix}$ (Choice B) B $\begin{bmatrix} y^2\cos(x) & 2y\sin(x) \\ \\ -y^2\sin(x) & 2\sin(x) \end{bmatrix}$ (Choice C) C $\begin{bmatrix} -y^2\sin(x) & 2y\cos(x) \\ \\ 2y\cos(x) & 2\sin(x) \end{bmatrix}$ (Choice D) D $\begin{bmatrix} 2\sin(x) & 2y\cos(x) \\ \\ 2y\cos(x) & -y^2\sin(x) \end{bmatrix}$
Solution: The Hessian of a scalar field $f$ is the matrix that contains all its second-order partial derivative information. $\bold{H}(f) = \begin{bmatrix} f_{xx} & f_{xy} \\ \\ f_{yx} & f_{yy} \end{bmatrix}$ Because the order of mixed partial derivatives often doesn't matter, the bottom left and top right entries of the Hessian are usually the same. Let's calculate the second order partial derivatives of $f$ ! $\begin{aligned} f_{xx} &= \dfrac{\partial}{\partial x} \left[ y^2\cos(x) \right] = -y^2\sin(x) \\ \\ f_{yx} &= \dfrac{\partial}{\partial y} \left[ y^2\cos(x) \right] = 2y\cos(x) \\ \\ f_{xy} &= \dfrac{\partial}{\partial x} \left[ 2y\sin(x) \right] = 2y\cos(x) \\ \\ f_{yy} &= \dfrac{\partial}{\partial y} \left[ 2y\sin(x) \right] = 2\sin(x) \end{aligned}$ Now we can put all the second-order partial derivatives together into the Hessian. $\bold{H}(f) = \begin{bmatrix} -y^2\sin(x) & 2y\cos(x) \\ \\ 2y\cos(x) & 2\sin(x) \end{bmatrix}$